#include <buola/scene/csceneview.h>
#include <buola/scene/ccontroller.h>

namespace buola { namespace scene {

using namespace gui;

CSceneView::CSceneView()
{
    Resize({1024,768});
    SetBackColor(img::CColor(0.2,0.4,0.2));
    SetPaintMode(EPaintMode::OPENGL);
    mTimer.SetInterval(chrono::milliseconds(50),true);
//    mTimer.sTimer.Connect(&CSceneView::Refresh,this);
}

CSceneView::~CSceneView()
{
    
}

void CSceneView::OnChar(const CKeyEvent &pE)
{
}

void CSceneView::OnExpose(const CExposeEvent &pE)
{
    Render();
}

void CSceneView::OnButtonDown(const CMouseEvent &pE)
{
    for(const PController &c : mControllers)
        c->OnButtonDown(pE);
}

void CSceneView::OnButtonUp(const CMouseEvent &pE)
{
    for(const PController &c : mControllers)
        c->OnButtonUp(pE);
}

void CSceneView::OnMouseMove(const CMouseEvent &pE)
{
    for(const PController &c : mControllers)
        c->OnMouseMove(pE);
}

void CSceneView::OnMouseWheel(const CMouseEvent &pE)
{
    for(const PController &c : mControllers)
        c->OnMouseWheel(pE);
}

void CSceneView::AddController(const PController &pController)
{
    mControllers.push_back(pController);
}

/*namespace gl*/ } /*namespace buola*/ }
